
#ifndef  SLEEPLOCK_H
#define  SLEEPLOCK_H

#include "types.h"
#include <pthread.h>

struct sleeplock {
  pthread_mutex_t locked;  
  char * name;
  volatile int is_locked;
};

void initsleeplock(struct sleeplock *lk, char *name);
void acquiresleep(struct sleeplock * lk);
void releasesleep(struct sleeplock * lk);
int holdingsleep(struct sleeplock * lk);


void destroysleep(struct sleeplock * lk);


#endif   /* SLEEPLOCK_H */
